<script setup lang='ts'>
import { getMessageCommentList } from '@/api/message';
import {  onMounted, ref } from 'vue';


const commentList = ref()
const getCommentList = async () => {
  const res = await getMessageCommentList()
  if(res.data.code === 0) {
    commentList.value = res.data.data
  }
}
onMounted(() => getCommentList())

// 下拉刷新
const loading = ref(false)
const onRefresh = () => {
  setTimeout(async () => {
    loading.value = false;
    await getCommentList()
  }, 1000);
}
</script>
<template>
  <van-sticky>
    <van-nav-bar
      title="评论"
      left-arrow
      @click-left="$router.back()"
    >
    </van-nav-bar>
  </van-sticky>
  <van-pull-refresh v-model="loading" @refresh="onRefresh"  success-text="刷新成功">
    <UserCommentList v-if="commentList && commentList.length>0" :commentList="commentList"></UserCommentList>
    <van-empty
      v-else
      style="margin-top: 100px;"
      image="https://fastly.jsdelivr.net/npm/@vant/assets/custom-empty-image.png"
      image-size="80"
      description="暂无其他评论"
    />
  </van-pull-refresh>
</template>
<style scoped >
</style>
